package components.dialogs.effects
{
	import UIFree.uif_component;
	
	import classes.c_util;
	
	import components.dialogs.c_elementPropDlg;
	import components.dialogs.c_filterPropDlg;
	import components.dialogs.c_propertyDialog;
	import components.editor.c_baseElement;
	
	import flash.events.Event;
	import flash.filters.GlowFilter;
	
	public class c_Glow extends c_filterPropDlg {
		private static const MAXDISTANCE: Number = 50
		public function c_Glow(parent:uif_component, a_element:c_baseElement, a_title:String='', modal:Boolean=false, canClose:int=2) {
			super(parent, a_element, a_title, modal, canClose);
		}
		
		override protected function propertyList():Array {
			return [
				{
					title	: 'Размытие',
					type	: c_propertyDialog.PTYPE_NUMBER,
					value	: glowFilter.blurX/0.2
				},{
					title	: 'Прозрачность',
					type	: c_propertyDialog.PTYPE_NUMBER,
					value	: glowFilter.alpha * 100
				},{
					title	: 'Интенсивность',
					type	: c_propertyDialog.PTYPE_NUMBER,
					value	: glowFilter.strength/0.2
				},{
					title	: 'Цвет',
					type	: c_propertyDialog.PTYPE_COLORPICKER,
					value	: glowFilter.color
				}
			]
		}
		
		protected function get glowFilter(): GlowFilter {
			return filter as GlowFilter;
		}
		
		override protected function filterClass():Class {
			return GlowFilter;
		}
		
		override protected function updateElement():void {
			glowFilter.blurX = values[0].value * 0.2;
			glowFilter.blurY = values[0].value * 0.2;
			glowFilter.alpha = values[1].value/100;
			glowFilter.strength = values[2].value * 0.2;
			glowFilter.color = values[3].value;
			super.updateElement();
		}		
	}
}